home *** CD-ROM | disk | FTP | other *** search
/ Software of the Month Club 2000 October / Software of the Month - Ultimate Collection Shareware 277.iso / pc / PROGRAMS / UTILITY / WINLINUX / DATA1.CAB / programs_-_include / LINUX / SUNRPC / XDR.H < prev    next >
C/C++ Source or Header  |  1999-09-17  |  2KB  |  80 lines

  1. /*
  2.  * include/linux/sunrpc/xdr.h
  3.  *
  4.  * Copyright (C) 1995, 1996 Olaf Kirch <okir@monad.swb.de>
  5.  */
  6.  
  7. #ifndef _SUNRPC_XDR_H_
  8. #define _SUNRPC_XDR_H_
  9.  
  10. #ifdef __KERNEL__
  11.  
  12. #include <linux/uio.h>
  13.  
  14. /*
  15.  * Buffer adjustment
  16.  */
  17. #define XDR_QUADLEN(l)        (((l) + 3) >> 2)
  18.  
  19. /*
  20.  * Generic opaque `network object.' At the kernel level, this type
  21.  * is used only by lockd.
  22.  */
  23. #define XDR_MAX_NETOBJ        1024
  24. struct xdr_netobj {
  25.     unsigned int        len;
  26.     u8 *            data;
  27. };
  28.  
  29. /*
  30.  * This is the generic XDR function. rqstp is either a rpc_rqst (client
  31.  * side) or svc_rqst pointer (server side).
  32.  * Encode functions always assume there's enough room in the buffer.
  33.  */
  34. typedef int    (*kxdrproc_t)(void *rqstp, u32 *data, void *obj);
  35.  
  36. /*
  37.  * These variables contain pre-xdr'ed values for faster operation.
  38.  * FIXME: should be replaced by macros for big-endian machines.
  39.  */
  40. extern u32    xdr_zero, xdr_one, xdr_two;
  41.  
  42. extern u32    rpc_success,
  43.         rpc_prog_unavail,
  44.         rpc_prog_mismatch,
  45.         rpc_proc_unavail,
  46.         rpc_garbage_args,
  47.         rpc_system_err;
  48.  
  49. extern u32    rpc_auth_ok,
  50.         rpc_autherr_badcred,
  51.         rpc_autherr_rejectedcred,
  52.         rpc_autherr_badverf,
  53.         rpc_autherr_rejectedverf,
  54.         rpc_autherr_tooweak,
  55.         rpc_autherr_dropit;
  56.  
  57. void        xdr_init(void);
  58.  
  59. /*
  60.  * Miscellaneous XDR helper functions
  61.  */
  62. u32 *    xdr_encode_string(u32 *p, const char *s);
  63. u32 *    xdr_decode_string(u32 *p, char **sp, int *lenp, int maxlen);
  64. u32 *    xdr_encode_netobj(u32 *p, const struct xdr_netobj *);
  65. u32 *    xdr_decode_netobj(u32 *p, struct xdr_netobj *);
  66. u32 *    xdr_decode_netobj_fixed(u32 *p, void *obj, unsigned int len);
  67.  
  68. /*
  69.  * Adjust iovec to reflect end of xdr'ed data (RPC client XDR)
  70.  */
  71. static inline int
  72. xdr_adjust_iovec(struct iovec *iov, u32 *p)
  73. {
  74.     return iov->iov_len = ((u8 *) p - (u8 *) iov->iov_base);
  75. }
  76.  
  77. #endif /* __KERNEL__ */
  78.  
  79. #endif /* _SUNRPC_XDR_H_ */
  80.